home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Includes / system / modules.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-12  |  5.2 KB  |  155 lines

  1. #ifndef SYSTEM_MODULES_H
  2. #define SYSTEM_MODULES_H TRUE
  3.  
  4. /*
  5. **  $VER: modules.h V1.2
  6. **
  7. **  (C) Copyright 1996-1998 DreamWorld Productions.
  8. **      All Rights Reserved.
  9. **
  10. */
  11.  
  12. #ifndef DPKERNEL_H
  13. #include <dpkernel/dpkernel.h>
  14. #endif
  15.  
  16. #ifndef SYSTEM_GLOBALBASE_H
  17. #include <system/globalbase.h>
  18. #endif
  19.  
  20. /*****************************************************************************
  21. ** Module Object.
  22. */
  23.  
  24. #define VER_MODULE  2
  25. #define TAGS_MODULE ((ID_SPCTAGS<<16)|ID_MODULE)
  26.  
  27. struct Module {
  28.   struct Head Head;              /* [00] Standard header */
  29.   WORD   Number;                 /* [12] Number of the associated module */
  30.   APTR   ModBase;                /* [14] Ptr to function jump table */
  31.   struct Segment *Segment;       /* [18] Segment pointer */
  32.   WORD   TableType;              /* [22] Type of table */
  33.   WORD   e01;                    /* [24] */
  34.   struct Function *FunctionList; /* [26] Array of functions */
  35.   LONG   MinVersion;             /* [30] Minimum required ver. of the module */
  36.   LONG   MinRevision;            /* [34] Minimum required rev. of the module */
  37.   LONG   e02;                    /* [38] */
  38.   BYTE   *Name;                  /* [42] Name of the module */
  39.   struct ModPublic *Public;      /* [46] Shared details on the module */
  40.  
  41.   /*** Private Variables ***/
  42.  
  43.   APTR   prvMBMemory;            /* Module base memory */
  44. };
  45.  
  46. struct Function {
  47.   APTR Address;
  48.   BYTE *Name;
  49. };
  50.  
  51. #define MODA_Number      (12|TWORD)
  52. #define MODA_TableType   (22|TWORD)
  53. #define MODA_MinVersion  (30|TLONG)
  54. #define MODA_MinRevision (34|TLONG)
  55. #define MODA_Name        (42|TAPTR)
  56.  
  57. /*****************************************************************************
  58. ** Table-Type definitions.
  59. */
  60.  
  61. #define JMP_DEFAULT 1  /* LVO jump type (standard) */
  62. #define JMP_AMIGAE  2  /* Amiga E jump table */
  63.  
  64. #define JMP_LIBRARY JMP_AMIGAE
  65. #define JMP_LVO     JMP_DEFAULT
  66.  
  67. /*****************************************************************************
  68. ** Module file header.
  69. */
  70.  
  71. #define MODULE_HEADER_V1 0x4D4F4401
  72.  
  73. struct ModHeader {
  74.   LONG Version;
  75.   LIBPTR LONG (*Init)(mreg(__a0) struct Module *, mreg(__a1) APTR DPKBase,
  76.                mreg(__a2) struct GVBase *, mreg(__d0) LONG dpkVersion,
  77.                mreg(__d1) LONG dpkRevision);
  78.   LIBPTR void (*Close)(mreg(__a0) struct Module *);
  79.   LIBPTR LONG (*Expunge)(void);
  80.   WORD  LVOType;         /* Type of function table to generate for our own use */
  81.   WORD  prvEmpty;        /* */
  82.   BYTE  *Author;         /* Author of the module */
  83.   struct Function *DefaultList;   /* Pointer to default function list */
  84.   LONG  CPUNumber;       /* CPU that this module is compiled for */
  85.   LONG  ModVersion;      /* Version of this module */
  86.   LONG  ModRevision;     /* Revision of this module */
  87.   LONG  MinDPKVersion;   /* Minimum DPK version required */
  88.   LONG  MinDPKRevision;  /* Minimum DPK revision required */
  89.   LIBPTR LONG (*Open)(mreg(__a0) struct Module *);
  90.   APTR  prvModBaseEmpty; /* Generated function base for given CPU */
  91.   BYTE  *Copyright;      /* Copyright details */
  92.   BYTE  *Date;           /* Date of compilation */
  93.   BYTE  *Name;           /* Name of the module */
  94.   WORD  DPKTable;        /* Type of function table to get from DPK */
  95.   WORD  emp;             /* Reserved */
  96. };
  97.  
  98. /*****************************************************************************
  99. ** This shared module structure is built during the initialisation process
  100. ** and placed in Module->Public.
  101. */
  102.  
  103. struct ModPublic {
  104.   WORD  Version;
  105.   WORD  OpenCount;      /* Amount of programs with this module open */
  106.   LIBPTR LONG (*Init)(mreg(__a0) struct Module *, mreg(__a1) APTR DPKBase,
  107.                mreg(__a2) struct GVBase *, mreg(__d0) LONG dpkVersion,
  108.                mreg(__d1) LONG dpkRevision);
  109.   LIBPTR void (*Close)(mreg(__a0) struct Module *);
  110.   LIBPTR LONG (*Expunge)(void);
  111.   LIBPTR LONG (*Open)(mreg(__a0) struct Module *);
  112.   LONG  CPU;            /* CPU that this module is compiled for */
  113.   LONG  ModVersion;     /* Version of this module */
  114.   LONG  ModRevision;    /* Revision of this module */
  115.   BYTE  *Author;        /* Author of the module */
  116.   BYTE  *Copyright;     /* Copyright details */
  117.   BYTE  *Date;          /* Date of compilation */
  118.   BYTE  *Name;          /* Name of the module */
  119.   struct ModHeader *Table; /* Type of function table to get from DPK */
  120. };
  121.  
  122. /*****************************************************************************
  123. ** This structure is 100% private to the dpkernel.
  124. */
  125.  
  126. struct ModEntry {
  127.   struct ModEntry  *Next;     /* Next module in list */
  128.   struct ModEntry  *Prev;     /* Previous module in list */
  129.   struct Segment   *Segment;  /* Module segment */
  130.   struct ModHeader *Header;   /* Pointer to module header */
  131.   WORD   ModuleID;            /* Module ID */
  132.   WORD   BaseType;            /* The type of PersonalBase (eg JMP_LVO) */
  133.   BYTE   *Name;               /* Name of the module */
  134.   struct ModPublic *Public;   /* Remember the details for the expunge */
  135.   APTR   PersonalBase;        /* Module's personal base structure */
  136.   APTR   PBMemory;            /* PersonalBase memory allocation */
  137. };
  138.  
  139. struct LVOFunction {
  140.   WORD Jump;
  141.   LONG Code;
  142. };
  143.  
  144. /****************************************************************************/
  145.  
  146. #define CPU_68000  1
  147. #define CPU_68010  2
  148. #define CPU_68020  3
  149. #define CPU_68030  4
  150. #define CPU_68040  5
  151. #define CPU_68060  6
  152.  
  153. #endif /* SYSTEM_MODULES_H */
  154.  
  155.